home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Interfaces & Libraries / Interfaces / CIncludes / stdlib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-05  |  3.0 KB  |  165 lines  |  [TEXT/MPS ]

  1. /*
  2.     StdLib.h -- General utilities
  3.  
  4.     Copyright Apple Computer,Inc.    1987, 1990, 1993-1995
  5.     All rights reserved.
  6.  
  7. */
  8. /* Conditional Macros:
  9.  *    UsingStaticLibs    - for CFM-68K:  Insures that #pragma import is never used.
  10.  *    <none>            - for CFM-68K:    Insures that all functions and data items are
  11.  *                                    marked as library imports
  12.  */
  13.  
  14.  
  15. #ifndef __STDLIB__
  16. #define __STDLIB__
  17.  
  18. /*
  19.  * Get common declarations 
  20.  */
  21.  
  22. #include <NullDef.h>
  23. #include <SizeTDef.h>
  24. #include <WCharTDef.h>
  25.  
  26. #ifdef powerc
  27. #pragma options align=power
  28. #endif
  29. struct div_t {
  30.     int quot;            /* quotient */
  31.     int rem;            /* remainder */
  32. } ;
  33. #ifdef powerc
  34. #pragma options align=reset
  35. #endif
  36. typedef struct div_t div_t;
  37.  
  38. #ifdef powerc
  39. #pragma options align=power
  40. #endif
  41. struct ldiv_t {
  42.     long int quot;        /* quotient */
  43.     long int rem;        /* remainder */
  44. };
  45. #ifdef powerc
  46. #pragma options align=reset
  47. #endif
  48. typedef struct ldiv_t ldiv_t;
  49.  
  50. #define EXIT_FAILURE 1
  51. #define EXIT_SUCCESS 0
  52.  
  53. #define RAND_MAX 32767
  54.  
  55. #define MB_CUR_MAX 1
  56.  
  57. #ifdef __cplusplus
  58. extern "C" {
  59. #endif
  60.  
  61.  
  62. #if defined (__CFM68K__) && !defined (UsingStaticLibs)
  63.     #pragma import on
  64. #endif
  65.  
  66.  
  67. /*
  68.  *    String conversion functions
  69.  */
  70.  
  71. double atof (const char *nptr);
  72. int atoi (const char *nptr);
  73. long int atol (const char *nptr);
  74. double strtod (const char *nptr, char **endptr);
  75. long int strtol (const char *nptr, char **endptr, int base);
  76. unsigned long int strtoul (const char *nptr, char **endptr, int base);
  77.  
  78.  
  79. /*
  80.  *    Pseudo-random sequence generation functions
  81.  */
  82.  
  83. int rand (void);
  84. void srand (unsigned int seed);
  85.  
  86.  
  87. /*
  88.  *    Memory management functions
  89.  */
  90.  
  91. void *calloc (size_t nmemb, size_t size);
  92. void free (void *ptr);
  93. void *malloc (size_t size);
  94. void *realloc (void *ptr, size_t size);
  95.  
  96.  
  97. /*
  98.  *    Communication with the environment
  99.  */
  100.  
  101. void abort (void);
  102. int atexit (void (*func)(void));
  103. void exit (int status);
  104. char *getenv (const char *name);
  105. int system (const char *string);
  106.  
  107.  
  108. /*
  109.  *    Searching and sorting utilities
  110.  */
  111.  
  112. void *bsearch (const void *key, const void *base,
  113.                size_t nmemb, size_t size,
  114.                int (*compar)(const void *, const void *));
  115. void qsort (void *base, size_t nmemb, size_t size,
  116.             int (*compar)(const void *, const void *));
  117.  
  118.  
  119. /*
  120.  *    Integer arithmetic functions
  121.  */
  122.  
  123. int abs (int j);
  124. div_t div (int numer, int denom);
  125. long int labs (long int j);
  126. ldiv_t ldiv (long int numer, long int denom);
  127.  
  128.  
  129. /*
  130.  *    Multibyte functions
  131.  */
  132.  
  133. int mblen (const char *s, size_t n);
  134. int mbtowc (wchar_t *pwc, const char *s, size_t n);
  135. int wctomb (char *s, wchar_t wchar);
  136. size_t mbstowcs (wchar_t *pwcs, const char *s, size_t n);
  137. size_t wcstombs (char *s, const wchar_t *pwcs, size_t n);
  138.  
  139. /*
  140.  *  Apple extentions
  141.  */
  142.  
  143. /* CFront can't handle the pretty version of this conditional 
  144. #if defined (__useAppleExts__) || \
  145.     ((defined (applec) && ! defined (__STDC__)) || \
  146.      (defined (__PPCC__) && __STDC__ == 0))
  147. */
  148. #if defined (__useAppleExts__) || ((defined (applec) && ! defined (__STDC__)) || (defined (__PPCC__) && __STDC__ == 0))
  149.  
  150. void _exit (int status);
  151.  
  152. #endif
  153.  
  154.  
  155. #if defined (__CFM68K__) && !defined (UsingStaticLibs)
  156.     #pragma import off
  157. #endif
  158.  
  159.  
  160. #ifdef __cplusplus
  161. }
  162. #endif
  163.  
  164. #endif
  165.